package com.ymatou.iapi.productmanager.testcase;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.productmanager.parameter.product.AddSellerProductRequest;
import com.ymatou.iapi.productmanager.parameter.product.ProductFreightSaveModel;
import com.ymatou.iapi.productmanager.parameter.product.ProductVideoSaveModel;
import com.ymatou.iapi.productmanager.service.AddSellerProductCall;
import com.ymatou.iapi.productmanager.service.SaveCatalogPackageListCall;
import com.ymatou.iapi.sellerproduct.parameter.ProdTplBean;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AddProductCallService;
import com.ymttest.business.service.LiveCallService;
import com.ymttest.business.service.SellerProductCallService;
import com.ymttest.common.order.userquery.util.HttpClientUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.MapUtil;

public class Ts_AddSellerProduct {
	private static String sellerName = EnvSetup.getData("productsellername");
	
	private static int sellerId = Integer.parseInt(EnvSetup.getData("productsellerid"));
	
	private static AddSellerProductCall addSellerProductCall = new AddSellerProductCall();
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("添加商品");
	}
	
	@Before
	public void caseUp() {
	}
	
	@AfterClass
	public static void tearDown() {
		Logger.generateResult(addSellerProductCall.getOpurl());
	}	
	
	@After
	public void caseDown() {
		Logger.end(); 
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_001() throws Exception {
		Logger.start(true,"添加 单规格商品");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("单规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_002() throws Exception {
		Logger.start(true,"添加多规格商品");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_003() throws Exception {
		Logger.start(true,"添加多规格商品,一个规格未启用");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			//未启用
			addProdReq.getProduct().getCatalogList().get(0).setAction(-2);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_004() throws Exception {
		Logger.start(true,"添加多规格商品带SPU");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			//未启用
			addProdReq.getProduct().getCatalogList().get(0).setAction(-2);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_005() throws Exception {
		Logger.start(true,"添加多规格商品带套装商品");
		try{
			SaveCatalogPackageListCall saveCatalogPackageListCall = new SaveCatalogPackageListCall();
			int packageId1 = saveCatalogPackageListCall.callAndGetReturnData(MapUtil.hashMap("ProductPackageList[0]->SubCatalogName","测试组合001测试组合001"))
									.getJSONObject("Data").getJSONArray("SubCatalogIdList").getInt(0);
			
			
			int packageId2 = saveCatalogPackageListCall.callAndGetReturnData(MapUtil.hashMap("ProductPackageList[0]->SubCatalogName","测试组合002测试组合001"))
					.getJSONObject("Data").getJSONArray("SubCatalogIdList").getInt(0);
			
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			//带上套装
			addProdReq.getProduct().getCatalogList().get(0).setSubCatalogIdList((Arrays.asList(packageId1,packageId2)));
			addProdReq.getProduct().getCatalogList().get(0).setPackage(true);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_006() throws Exception {
		Logger.start(true,"添加多规格商品带模板");
		try{
			
			SellerProductCallService.deleteTemplate(sellerId);
			//	模版类型（1，尺码模版 2，买家须知 3，买手服务）
			ProdTplBean sizeTemplate = SellerProductCallService.saveTemplate(sellerId, 1);
			ProdTplBean buyerNoticeTemplate = SellerProductCallService.saveTemplate(sellerId, 2);
			ProdTplBean sellerServiceTemplate = SellerProductCallService.saveTemplate(sellerId, 3);
			
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().getDescModel().setSizeTemplateId(sizeTemplate.getTemplateId());
			addProdReq.getProduct().getDescModel().setBuyerNoticeId(buyerNoticeTemplate.getTemplateId());
			addProdReq.getProduct().getDescModel().setSellerServiceId(sellerServiceTemplate.getTemplateId());
			
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_007() throws Exception {
		Logger.start(true,"添加多规格商品带模板带大贸");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().getDescModel().setDeclarationId(123);;
			
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_008() throws Exception {
		Logger.start(true,"添加多规格商品带运费模板");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			ProductFreightSaveModel  freightModel = new ProductFreightSaveModel();
			freightModel.setCatalogStatus(3);
			freightModel.setTemplateId(4123);
			addProdReq.getProduct().setFreightTemplateList(Arrays.asList(freightModel));
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_009() throws Exception {
		Logger.start(true,"添加多规格商品带多物流");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().setMultiLogistics(3);
			addProdReq.getProduct().setFlightBalance(20d);
			addProdReq.getProduct().getCatalogList().get(0).setMultiLogistics(3);
			
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_010() throws Exception {
		Logger.start(true,"添加多规格商品带视频");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
		
			ProductVideoSaveModel productVideo = new ProductVideoSaveModel();
			productVideo.setVideoUrl("http://v2.ymatou.com/uploads/20180103/6a44924f0b4968e88321061a3704b4cf.mp4");
			productVideo.setPic("http://pic1.ymatou.com/G01/shangou/M00/3B/22/rBBlD1pMiOCAWitxAADUmGEFNI0402_1_1_n_w_o.jpg");
			productVideo.setLength(11573);
			productVideo.setWidth(400);
			productVideo.setHeight(30);
			productVideo.setSize(3070568);
			addProdReq.getProduct().setVideoModel(productVideo);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_011() throws Exception {
		Logger.start(true,"添加多规格商品带加入直播");
		try{
			List<Integer> liveIds = LiveCallService.createLivesInProcessAndInFuture(sellerId, sellerName, 2, 3);
			
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
		
			addProdReq.getProduct().setLiveIdList(liveIds);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_012() throws Exception {
		Logger.start(true,"添加多规格 预定商品");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().getCatalogList().get(0).setPreSale(true);
		
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			String productId = ret.getJSONObject("Data").getString("ProductId");
			
			AddProductCallService.checkAddProduct(productId, addProdReq);
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	///////////////////////////////////////////////////////////////////////////////////////
	//逆向
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_901() throws Exception {
		Logger.start(true,"商品节点 沒有");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.setProduct(null);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(400, ret.getInt("Code"), "返回code");
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_902() throws Exception {
		Logger.start(true,"规格节点 沒有");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().setCatalogList(null);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_903() throws Exception {
		Logger.start(true,"库存小于等于0");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().getCatalogList().get(0).setStock(-1);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_904() throws Exception {
		Logger.start(true,"价格小于等于0");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			//price
			addProdReq.getProduct().getCatalogList().get(0).setPrice(0);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			addProdReq.getProduct().getCatalogList().get(0).setPrice(-1.1);
			JSONObject ret1 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret1.getInt("Code"), "返回code");
			
			//vip price
			addProdReq.getProduct().getCatalogList().get(0).setPrice(100);
			addProdReq.getProduct().getCatalogList().get(0).setVipPrice(-1);
			JSONObject ret2 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret2.getInt("Code"), "返回code");
			
			
			//new price
			addProdReq.getProduct().getCatalogList().get(0).setVipPrice(99);
			addProdReq.getProduct().getCatalogList().get(0).setNewPrice(-2);
			JSONObject ret3 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret3.getInt("Code"), "返回code");
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_905() throws Exception {
		Logger.start(true,"vip,新客价格大于原价");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			//vip price
			addProdReq.getProduct().getCatalogList().get(0).setPrice(10000);
			addProdReq.getProduct().getCatalogList().get(0).setVipPrice(100002);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			
			//new price
			addProdReq.getProduct().getCatalogList().get(0).setPrice(10000);
			addProdReq.getProduct().getCatalogList().get(0).setVipPrice(999);
			addProdReq.getProduct().getCatalogList().get(0).setNewPrice(10003);
			JSONObject ret1 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret1.getInt("Code"), "返回code");
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_906() throws Exception {
		Logger.start(true,"缺少文描节点");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			addProdReq.getProduct().getDescModel().setDescription(null);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			addProdReq.getProduct().getDescModel().setDescription("");
			JSONObject ret1 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret1.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_907() throws Exception {
		Logger.start(true,"品类id为0");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			addProdReq.getProduct().setThirdCategoryId(0);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_908() throws Exception {
		Logger.start(true,"没有主图，或主图无效");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			addProdReq.getProduct().setProductPicList(new ArrayList<>());
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			addProdReq.getProduct().setProductPicList(null);
			JSONObject ret1 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret1.getInt("Code"), "返回code");
			
			
			addProdReq.getProduct().setProductPicList(Arrays.asList("ddsfdsaf"));
			JSONObject ret2 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret2.getInt("Code"), "返回code");
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_910() throws Exception {
		Logger.start(true,"发布不上架自动延期商品");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			addProdReq.getProduct().setAutoRefresh(true);
			addProdReq.getProduct().setOnSaleType(2);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_911() throws Exception {
		Logger.start(true,"缺少商品名称");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			addProdReq.getProduct().setProductName("");
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			addProdReq.getProduct().setProductName(null);
			JSONObject ret1 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret1.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_912() throws Exception {
		Logger.start(true,"缺少买手Id");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			addProdReq.setSellerId(0);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_913() throws Exception {
		Logger.start(true,"缺少品牌Id");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			addProdReq.getProduct().setBrandId(0);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Ignore
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_914() throws Exception {
		Logger.start(true,"开始时间晚于结束时间");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			
			addProdReq.getProduct().setValidStart("2117-11-02 17:43:36");
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_915() throws Exception {
		Logger.start(true,"isPackage 为ture,却没套装信息");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			//带上套装
			addProdReq.getProduct().getCatalogList().get(0).setSubCatalogIdList(new ArrayList<>());
			addProdReq.getProduct().getCatalogList().get(0).setPackage(true);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_916() throws Exception {
		Logger.start(true,"FBX不支持预定");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().setCatalogType(2);
			addProdReq.getProduct().getCatalogList().get(0).setPreSale(true);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_917() throws Exception {
		Logger.start(true,"除2,3,6 物流外，不支持预定");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			addProdReq.getProduct().getCatalogList().get(0).setPreSale(true);
			
			
			addProdReq.getProduct().setCatalogStatus(4);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(200, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Ignore
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_918() throws Exception {
		Logger.start(true,"spu 必填值未填");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().getPropertyList().stream().filter(x->x.getPropertyId()==9).
								findAny().orElse(null).setPropertyValues(new ArrayList<>());
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_919() throws Exception {
		Logger.start(true,"发不允许品牌");
		try{
			JSONObject retBrand = new JSONObject(HttpClientUtil.requestPost("http://sellerAllocation.iapi.ymatou.com/Api/SellerAllocation/GetSellerCategory",
						MapUtil.hashMap("SellerId",String.valueOf(sellerId))));
			
			
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().setBrandId(retBrand.getJSONObject("Data").getJSONArray("BadBrandIDs").getInt(0));
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_920() throws Exception {
		Logger.start(true,"商品的物流方式不支持该价格");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().setCatalogStatus(7);
			addProdReq.getProduct().getCatalogList().get(0).setPrice(1200);
			addProdReq.getProduct().getCatalogList().get(1).setPrice(1200);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_921() throws Exception {
		Logger.start(true,"多物流差价值未填");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().getCatalogList().get(0).setMultiLogistics(3);
			addProdReq.getProduct().setMultiLogistics(2);
			addProdReq.getProduct().setFlightBalance(0);
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_923() throws Exception {
		Logger.start(true,"不能添加FBX贝海国内仓商品进入扫货现场");
		try{
			List<Integer> liveIds = LiveCallService.createLivesInProcessAndInFuture(sellerId, sellerName, 2, 3);
			
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
		
			addProdReq.getProduct().setLiveIdList(liveIds);
			
			addProdReq.getProduct().setCatalogType(2);
			addProdReq.getProduct().setCatalogStatus(5);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			
			addProdReq.getProduct().setCatalogStatus(4);
			JSONObject ret1 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret1.getInt("Code"), "返回code");
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_924() throws Exception {
		Logger.start(true,"productname敏感词校验");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().setProductName("绝对好用 美国丝径");
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_925() throws Exception {
		Logger.start(true,"文描敏感词校验");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().getDescModel().setDescription("绝对好用 美国丝径");
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_926() throws Exception {
		Logger.start(true,"商品属性敏感词校验");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().getPropertyList().get(0).setPropertyValues(Arrays.asList("绝对好用 美国丝径"));
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_927() throws Exception {
		Logger.start(true,"规格属性敏感词校验");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().getCatalogList().get(0).getPropertyList().get(0).setPropertyValue("绝对好用 美国丝径");
			
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_AddSellerProduct_928() throws Exception {
		Logger.start(true,"规格属性敏感词校验");
		try{
			AddSellerProductRequest addProdReq = AddProductCallService.getAddSellerProductRequestFromFile("多规格带SPU", 
					MapUtil.hashMap("sellerId",sellerId,"sellerName",sellerName));
			
			addProdReq.getProduct().setBrandId(0);
			JSONObject ret = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret.getInt("Code"), "返回code");
			
			
			addProdReq.getProduct().setBrandId(31231);
			JSONObject ret2 = addSellerProductCall.callAndGetReturnData(addProdReq);
			Logger.verifyEquals(201, ret2.getInt("Code"), "返回code");
			
			
		}catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
}
